package com.yunhai.xc.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yunhai.xc.user.domain.User;
import com.yunhai.xc.user.service.UserService;
import com.yunhai.xc.util.RedisUtils;

@RestController
@RequestMapping("/redis")
public class Redis {
	@Autowired
	private UserService userService;

	@RequestMapping("/p1") // redis存取测试
	public void test1() {
		RedisUtils.set("123", 111, 3000L);
	}

	@RequestMapping("/p2") // 新增缓存测试
	public void test2() {
		User user = userService.selectById(1);
		System.out.println(user.getAge());
	}

	@RequestMapping("/p3") // 更新缓存测试
	public void test4() {
		userService.updateById(1);
	}

	@RequestMapping("/p4") // 删除缓存测试
	public void test5() {
		userService.deleteById(1);
	}
}
